define(function (require, exports, module) {
    var angular = require('angular');
    require('angular-route');
    require('/public/js/myservice/contract/contract-ctrl');
    require('/public/js/myservice/invoice/list');
    require('/public/js/myservice/balance/list');
    require('/public/js/myservice/abnormal/violated-contract-list');
    require('/public/js/myservice/abnormal/special-invoice-list');
    require('/public/js/myservice/abnormal/special-authorize-list');

    angular.module('myBackendApp', ['ngRoute', 'Contract', 'Invoice', 'Balance', 'ViolatedContract', 'SpecialInvoice', 'SpecialAuthorize'])
        .factory('config', function () {
            return {
                app: {
                    name: '明源云客管理后台',
                    description: '明源云客'
                },
                user: {
                    name: '管理员',
                    picture: ''
                }
            };
        })
        .config(['$routeProvider',
            function ($routeProvider) {
                $routeProvider
                    .when("/", {redirectTo: '/contract'})
                    .when('/contract', {
                        templateUrl: 'contract/list.html',
                        //controller: 'contractListCtrl',
                        resolve: {
                            'test': function () {
                                return {name: '333334444'};
                            }
                        }
                    })
                    .when('/balance', {
                        templateUrl: 'balance/list.html'
                        //controller: 'balanceListCtrl'
                    })
                    .when('/invoice', {
                        templateUrl: 'invoice/list.html'
                        //controller: 'invoiceListCtrl'
                    })
                    .when('/violated_contract', {
                        templateUrl: 'abnormal/violated_contract_list.html',
                        controller: 'violatedContractListCtrl'
                    })
                    .when('/special_approval_invoice', {
                        templateUrl: 'abnormal/special_invoice_list.html',
                        controller: 'specialInvoiceListCtrl'
                    })
                    .when('/special_approval_authorize', {
                        templateUrl: 'abnormal/special_authorize_list.html',
                        controller: 'specialAuthorizeListCtrl'
                    });
            }])
        .service('appservice', function ($rootScope) {
            return {name: '明源云客'};
        })
        .controller('appctrl', ['$scope', 'appservice', function ($scope, appservice) {
            $scope.app = appservice;
        }]);
    angular.bootstrap(document, ['myBackendApp']);
});